/**
 * Created by Administrator on 2017/12/22/022.
 */
//  live 直播 类型
const LIVE_TYPE = {
  LIVE_START: 'LIVE_START', // 开始直播
  LIVE_PAUSE: 'LIVE_PAUSE', // 暂停直播
  LIVE_CONTINUE: 'LIVE_CONTINUE', // 恢复直播
}
//  replay 直播 类型
const REPLAY_TYPE = {
  REPLAY_START: 'REPLAY_START', // 开始直播
}

//  replay 录制 类型
const DO_REPLAY_TYPE = {
  DO_REPLAY_START: 'DO_REPLAY_START', // 开始录制
  DO_REPLAY_STOP: 'DO_REPLAY_STOP', //结束录制
  DO_REPLAY_PAUSE: 'DO_REPLAY_PAUSE', //暂停录制
  DO_REPLAY_CONTINUE: 'DO_REPLAY_CONTINUE', //继续录制
}
const COMMON_TYPE = {
  // 系统通知
  COMMON_SYSTEM_TIP: 'COMMON_SYSTEM_TIP',
  //  点赞直播
  COMMON_STAR_LIVE: 'COMMON_STAR_LIVE',
  //  弹幕提问
  COMMON_DM_QUESTION: 'COMMON_DM_QUESTION',
  //  弹幕回答提问
  COMMON_DM_ANSWER: 'COMMON_DM_ANSWER',
  //  弹幕点赞提问
  COMMON_DM_QUESTION_UP: 'COMMON_DM_QUESTION_UP',
  //  弹幕点赞回答
  COMMON_DM_ANSWER_UP: 'COMMON_DM_ANSWER_UP',

  COMMON_QA_QUESTION: 'COMMON_QA_QUESTION',
  //  弹幕回答提问
  COMMON_QA_ANSWER: 'COMMON_QA_ANSWER',
  //  弹幕提问
  COMMON_QA_QUESTION_UP: 'COMMON_QA_QUESTION_UP',
  //  弹幕提问
  COMMON_QA_ANSWER_UP: 'COMMON_QA_ANSWER_UP',
  //  开始直播
  COMMON_START: 'COMMON_START',
  //  结束直播
  COMMON_END: 'COMMON_END',
  //  暂停直播
  COMMON_PAUSE: 'COMMON_PAUSE',
  //  恢复直播
  COMMON_CONTINUE: 'COMMON_CONTINUE',
  //  开始录音
  COMMON_START_RECORD: 'COMMON_START_RECORD',
  //  结束录音
  COMMON_STOP_RECORD: 'COMMON_STOP_RECORD',
  //  用户列表
  COMMON_GET_USERS: 'COMMON_GET_USERS',
  //  发送弹幕
  COMMON_DM_TEXT: 'COMMON_DM_TEXT',
  //  发送图片
  COMMON_LIVE_IMAGE: 'COMMON_LIVE_IMAGE',
  //  发送语音
  COMMON_LIVE_VOICE: 'COMMON_LIVE_VOICE',
  //  切换图片
  COMMON_LIVE_SLIDE: 'COMMON_LIVE_SLIDE',
  //  播放视频
  COMMON_START_VIDEO: 'COMMON_START_VIDEO',
  //  播放素材
  COMMON_LIVE_MATERIAL: 'COMMON_LIVE_MATERIAL',
  //  开始QA
  COMMON_START_QA: 'COMMON_START_QA',
  //  QA 文字
  COMMON_QA_TEXT: 'COMMON_QA_TEXT',
  //  QA 文字抓换为问题
  COMMON_QA_TEXT_TRANSFER_QUESTION: 'COMMON_QA_TEXT_TRANSFER_QUESTION',
  // QA 文字抓换为问题返回
  COMMON_QA_TEXT_TRANSFER_QUESTION_SUCCESS: 'COMMON_QA_TEXT_TRANSFER_QUESTION_SUCCESS',
  //  QA 语音
  COMMON_QA_VOICE: 'COMMON_QA_VOICE',
  //  QA 图片
  COMMON_QA_IMAGE: 'COMMON_QA_IMAGE',
  //  QA 开始抽奖
  COMMON_QA_START_GIFT: 'COMMON_QA_START_GIFT',
  //  QA 参加抽奖
  COMMON_QA_JOIN_GIFT: 'COMMON_QA_JOIN_GIFT',
  //  QA 抽奖结束
  COMMON_QA_GIFT_END: 'COMMON_QA_GIFT_END',
  // QA 开始录音
  COMMON_QA_START_RECORD: 'COMMON_QA_START_RECORD',
  //  QA 结束录音
  COMMON_QA_STOP_RECORD: 'COMMON_QA_STOP_RECORD',
  //  加入房间
  COMMON_ENTER_ROOM: 'COMMON_ENTER_ROOM',
  //  减去合成音频的视频时间
  COMMON_SEND_BLANK: 'COMMON_SEND_BLANK',

  // 录制素材
  // 开始录制素材
  MATERIAL_START: 'MATERIAL_START',
  // 结束录制素材
  MATERIAL_END: 'MATERIAL_END',
  // 暂停录制素材
  MATERIAL_PAUSE: 'MATERIAL_PAUSE',
  // 继续录制素材
  MATERIAL_CONTINUE: 'MATERIAL_CONTINUE',
  // 开始录音
  MATERIAL_START_RECORD: 'MATERIAL_START_RECORD',
  // 结束录音
  MATERIAL_STOP_RECORD: 'MATERIAL_STOP_RECORD',
  //  发送录音
  MATERIAL_LIVE_VOICE: 'MATERIAL_LIVE_VOICE',
  //  上传图片
  MATERIAL_LIVE_IMAGE: 'MATERIAL_LIVE_IMAGE',
  //  滑动图片
  MATERIAL_LIVE_SLIDE: 'MATERIAL_LIVE_SLIDE',
  //  播放视频
  MATERIAL_START_VIDEO: 'MATERIAL_START_VIDEO',
  //  空白时间
  MATERIAL_SEND_VIDEO_BLANK: 'MATERIAL_SEND_VIDEO_BLANK'

}

const SEND_TYPE = {
  COMMON_QA_QUESTION: {
    m: 'faq',
    a: 'question'
  },
  COMMON_QA_ANSWER: {
    m: 'faq',
    a: 'answer'
  },
  COMMON_QA_QUESTION_UP: {
    m: 'faq',
    a: 'questionUp'
  },
  COMMON_QA_ANSWER_UP: {
    m: 'faq',
    a: 'answerUp'
  },
  COMMON_STAR_LIVE: {
    m: 'room',
    a: 'up'
  },
  COMMON_DM_QUESTION: {
    m: 'room',
    a: 'question'
  },
  COMMON_DM_ANSWER: {
    m: 'room',
    a: 'answer'
  },
  COMMON_DM_QUESTION_UP: {
    m: 'room',
    a: 'questionUp'
  },
  COMMON_DM_ANSWER_UP: {
    m: 'room',
    a: 'answerUp'
  },
  COMMON_SEND_BLANK: {
    m: 'room',
    a: 'sendBlankDuration'
  },
  COMMON_START: {
    m: 'room',
    a: 'startLive'
  },
  COMMON_END: {
    m: 'room',
    a: 'endLive'
  },
  COMMON_PAUSE: {
    m: 'room',
    a: 'pauseLive'
  },
  COMMON_CONTINUE: {
    m: 'room',
    a: 'reuseLive'
  },
  COMMON_START_RECORD: {
    m: 'room',
    a: 'startTape'
  },
  COMMON_STOP_RECORD: {
    m: 'room',
    a: 'endTape'
  },
  COMMON_GET_USERS: {
    m: 'room',
    a: 'getUsers'
  },
  COMMON_DM_TEXT: {
    m: 'room',
    a: 'sendBarrage'
  },
  COMMON_LIVE_IMAGE: {
    m: 'room',
    a: 'sendImage'
  },
  COMMON_LIVE_VOICE: {
    m: 'room',
    a: 'sendAudio'
  },
  COMMON_LIVE_SLIDE: {
    m: 'room',
    a: 'switchImage'
  },
  COMMON_LIVE_MATERIAL: {
    m: 'room',
    a: 'sendMaterial'
  },
  COMMON_START_VIDEO: {
    m: 'room',
    a: 'sendVideo'
  },
  COMMON_JOIN_ROOM: {
    m: 'common',
    a: 'enterRoom'
  },
  COMMON_JOIN_REPLAY_ROOM: {
    m: 'common',
    a: 'enterPlayback'
  },
  COMMON_LEAVE_ROOM: {
    m: 'common',
    a: 'leaveRoom'
  },
  COMMON_START_QA: {
    m: 'faq',
    a: 'startFaq'
  },
  COMMON_END_QA: {
    m: 'faq',
    a: 'endFaq'
  },
  COMMON_QA_TEXT: {
    m: 'faq',
    a: 'sendText'
  },
  COMMON_QA_VOICE: {
    m: 'faq',
    a: 'sendAudio'
  },
  COMMON_QA_JOIN_GIFT: {
    m: 'faq',
    a: 'joinLottery'
  },
  COMMON_QA_IMAGE: {
    m: 'faq',
    a: 'sendImage'
  },
  COMMON_QA_START_RECORD: {
    m: 'faq',
    a: 'startTape'
  },
  COMMON_QA_STOP_RECORD: {
    m: 'faq',
    a: 'endTape'
  },
  //  录制素材
  MATERIAL_JOIN_ROOM: {
    m: 'common',
    a: 'enterMaterial'
  },
  MATERIAL_START: {
    m: 'material',
    a: 'start'
  },
  MATERIAL_END: {
    m: 'material',
    a: 'end'
  },
  MATERIAL_PAUSE: {
    m: 'material',
    a: 'pause'
  },
  MATERIAL_CONTINUE: {
    m: 'material',
    a: 'reuse'
  },
  MATERIAL_START_RECORD: {
    m: 'material',
    a: 'startTape'
  },
  MATERIAL_STOP_RECORD: {
    m: 'material',
    a: 'endTape'
  },
  MATERIAL_LIVE_VOICE: {
    m: 'material',
    a: 'sendAudio'
  },
  MATERIAL_LIVE_IMAGE: {
    m: 'material',
    a: 'sendImage'
  },
  MATERIAL_LIVE_SLIDE: {
    m: 'material',
    a: 'switchImage'
  },
  MATERIAL_START_VIDEO: {
    m: 'material',
    a: 'sendVideo'
  },
  MATERIAL_SEND_VIDEO_BLANK: {
    m: 'material',
    a: 'sendBlankDuration'
  },
}

const GET_TYPE = {
  GET_SYSTEM_TIP: {
    msg_type: 'sys',
    msg_code: 1,
    type: 'COMMON_SYSTEM_TIP'
  },
  GET_QA_QUESTION: {
    msg_type: 'faq',
    msg_code: 11,
    type: 'COMMON_QA_QUESTION'
  },
  GET_QA_ANSWER: {
    msg_type: 'faq',
    msg_code: 12,
    type: 'COMMON_QA_ANSWER'
  },
  GET_QA_QUESTION_UP: {
    msg_type: 'faq',
    msg_code: 13,
    type: 'COMMON_QA_QUESTION_UP'
  },
  GET_QA_ANSWER_UP: {
    msg_type: 'faq',
    msg_code: 14,
    type: 'COMMON_QA_ANSWER_UP'
  },
  GET_STAR_LIVE: {
    msg_type: 'room',
    msg_code: 23,
    type: 'COMMON_STAR_LIVE'
  },
  GET_DM_QUESTION: {
    msg_type: 'room',
    msg_code: 19,
    type: 'COMMON_DM_QUESTION'
  },
  GET_DM_ANSWER: {
    msg_type: 'room',
    msg_code: 20,
    type: 'COMMON_DM_ANSWER'
  },
  GET_DM_QUESTION_UP: {
    msg_type: 'room',
    msg_code: 21,
    type: 'COMMON_DM_QUESTION_UP'
  },
  GET_DM_ANSWER_UP: {
    msg_type: 'room',
    msg_code: 22,
    type: 'COMMON_DM_ANSWER_UP'
  },
  GET_START: {
    msg_type: 'room',
    msg_code: 1,
    type: 'COMMON_START'
  },
  GET_END: {
    msg_type: 'room',
    msg_code: 2,
    type: 'COMMON_END'
  },
  GET_USERS: {
    msg_type: 'room',
    msg_code: 3,
    type: 'COMMON_GET_USERS'
  },
  GET_DM: {
    msg_type: 'room',
    msg_code: 4,
    type: 'COMMON_DM_TEXT'
  },
  GET_LIVE_SLIDE: {
    msg_type: 'room',
    msg_code: 5,
    type: 'COMMON_LIVE_SLIDE'
  },
  GET_START_VIDEO: {
    msg_type: 'room',
    msg_code: 12,
    type: 'COMMON_START_VIDEO'
  },
  GET_LIVE_VOICE: {
    msg_type: 'room',
    msg_code: 6,
    type: 'COMMON_LIVE_VOICE'
  },
  GET_LIVE_IMAGE: {
    msg_type: 'room',
    msg_code: 7,
    type: 'COMMON_LIVE_IMAGE'
  },
  GET_LIVE_MATERIAL: {
    msg_type: 'room',
    msg_code: 13,
    type: 'COMMON_LIVE_MATERIAL'
  },
  GET_PAUSE: {
    msg_type: 'room',
    msg_code: 8,
    type: 'COMMON_PAUSE'
  },
  GET_CONTINUE: {
    msg_type: 'room',
    msg_code: 9,
    type: 'COMMON_CONTINUE'
  },
  GET_START_RECORD: {
    msg_type: 'room',
    msg_code: 10,
    type: 'COMMON_START_RECORD'
  },
  GET_STOP_RECORD: {
    msg_type: 'room',
    msg_code: 11,
    type: 'COMMON_STOP_RECORD'
  },
  GET_START_QA: {
    msg_type: 'faq',
    msg_code: 1,
    type: 'COMMON_START_QA'
  },
  GET_QA_TEXT_TRANSFER_QUESTION_SUCCESS: {
    msg_type: 'faq',
    msg_code: 15,
    type: 'COMMON_QA_TEXT_TRANSFER_QUESTION_SUCCESS'
  },
  GET_QA_TEXT: {
    msg_type: 'faq',
    msg_code: 2,
    type: 'COMMON_QA_TEXT'
  },
  GET_QA_IMAGE: {
    msg_type: 'faq',
    msg_code: 3,
    type: 'COMMON_QA_IMAGE'
  },
  GET_QA_VOICE: {
    msg_type: 'faq',
    msg_code: 4,
    type: 'COMMON_QA_VOICE'
  },
  GET_QA_START_RECORD: {
    msg_type: 'faq',
    msg_code: 5,
    type: 'COMMON_QA_START_RECORD'
  },
  GET_QA_STOP_RECORD: {
    msg_type: 'faq',
    msg_code: 6,
    type: 'COMMON_QA_STOP_RECORD'
  },
  GET_QA_START_GIFT: {
    msg_type: 'faq',
    msg_code: 7,
    type: 'COMMON_QA_START_GIFT'
  },
  GET_QA_GIFT_END: {
    msg_type: 'faq',
    msg_code: 8,
    type: 'COMMON_QA_GIFT_END'
  },
  GET_QA_JOIN_GIFT: {
    msg_type: 'faq',
    msg_code: 9,
    type: 'COMMON_QA_JOIN_GIFT'
  },
  //  录制
  GET_MATERIAL_START: {
    msg_type: 'material',
    msg_code: 1,
    type: COMMON_TYPE.MATERIAL_START
  },
  GET_MATERIAL_END: {
    msg_type: 'material',
    msg_code: 2,
    type: COMMON_TYPE.MATERIAL_END
  },
  GET_MATERIAL_PAUSE: {
    msg_type: 'material',
    msg_code: 3,
    type: COMMON_TYPE.MATERIAL_PAUSE
  },
  GET_MATERIAL_CONTINUE: {
    msg_type: 'material',
    msg_code: 4,
    type: COMMON_TYPE.MATERIAL_CONTINUE
  },
  GET_MATERIAL_START_RECORD: {
    msg_type: 'material',
    msg_code: 5,
    type: COMMON_TYPE.MATERIAL_START_RECORD
  },
  GET_MATERIAL_STOP_RECORD: {
    msg_type: 'material',
    msg_code: 6,
    type: COMMON_TYPE.MATERIAL_STOP_RECORD
  },
  GET_MATERIAL_LIVE_VOICE: {
    msg_type: 'material',
    msg_code: 8,
    type: COMMON_TYPE.MATERIAL_LIVE_VOICE
  },
  GET_MATERIAL_LIVE_IMAGE: {
    msg_type: 'material',
    msg_code: 9,
    type: COMMON_TYPE.MATERIAL_LIVE_IMAGE
  },
  GET_MATERIAL_LIVE_SLIDE: {
    msg_type: 'material',
    msg_code: 10,
    type: COMMON_TYPE.MATERIAL_LIVE_SLIDE
  },
  GET_MATERIAL_START_VIDEO: {
    msg_type: 'material',
    msg_code: 11,
    type: COMMON_TYPE.MATERIAL_START_VIDEO
  }
}

const INFO_TYPE = {
  MSG_TYPE: 'info',
  ONLINE_NOTICE: {
    msg_type: 'info',
    msg_code: 1
  },
  OFFLINE_NOTICE: {
    msg_type: 'info',
    msg_code: 2
  },
  JOIN_ROOM_NOTICE: {
    msg_type: 'info',
    msg_code: 3
  },
  LEAVE_ROOM_NOTICE: {
    msg_type: 'info',
    msg_code: 4
  },
  SELF_JOIN_ROOM_NOTICE: {
    msg_type: 'info',
    msg_code: 5
  },
  LEAVE_MATERIAL_ROOM_NOTICE: {
    msg_type: 'info',
    msg_code: 8
  },
  SELF_JOIN_MATERIAL_ROOM_NOTICE: {
    msg_type: 'info',
    msg_code: 7
  },
  SYS_GLOBAL_TIME_NOTICE: {
    msg_type: 'info',
    msg_code: 6
  }
}

const ERROR_TYPE = {
  MSG_TYPE: 'error',
  NO_LOGIN_ERROR: {
    msg_type: 'error',
    msg_code: 1
  },
  TOKEN_ERROR: {
    msg_type: 'error',
    msg_code: 2
  },
  NO_TOKEN_ERROR: {
    msg_type: 'error',
    msg_code: 3
  },
  HAS_LOGIN_ERROR: {
    msg_type: 'error',
    msg_code: 4
  },
  LOGOUT_ERROR: {
    msg_type: 'error',
    msg_code: 5
  },
  SERVER_ERROR: {
    msg_type: 'error',
    msg_code: 6
  }
}

const NOTICE_TYPE = {
  MSG_TYPE: 'notice',
  ERROR_METHOD_NOTICE: {
    msg_type: 'notice',
    msg_code: 1
  },
  NO_ROOM_NOTICE: {
    msg_type: 'notice',
    msg_code: 2
  },
  NO_USER_NOTICE: {
    msg_type: 'notice',
    msg_code: 3
  },
  ROOM_NOT_START_NOTICE: {
    msg_type: 'notice',
    msg_code: 4
  },
}

const NEED_HANDLE_SELF_MSG_TYPE = []

const SOCKET_ERROR_CODE = {
  //  连接成功
  CON_SUCCESS: {
    code: 1,
    msg: '连接成功'
  },
  //
  CON_LOSE: {
    code: 2,
    msg: '断开连接, 重连中'
  },
  //  连接失败,
  CON_FAIL: {
    code: 3,
    msg: '连接失败'
  },
  //  重新连接
  CON_RE_SUCCESS: {
    code: 4,
    msg: '重新连接'
  },
  // 上线
  USER_ONLINE: {
    code: 5,
    msg: '上线'
  },
  //  进入房间
  USER_JOIN_ROOM: {
    code: 6,
    msg: '进入房间'
  },
  //  sys error
  SYS_ERROR: {
    code: 7,
    msg: 'sys error'
  },
  //  sys notice
  SYS_NOTICE: {
    code: 8,
    msg: 'sys notice'
  },
  INFO_NOTICE: {
    code: 9,
    msg: 'info notice'
  }
}

const DELAY_TYPE = [
  COMMON_TYPE.COMMON_LIVE_VOICE,
  COMMON_TYPE.COMMON_START_VIDEO,
  COMMON_TYPE.MATERIAL_LIVE_VOICE,
  COMMON_TYPE.MATERIAL_START_VIDEO,
  COMMON_TYPE.COMMON_LIVE_MATERIAL
]

const TYPE = {
  LIVE_TYPE: LIVE_TYPE,
  REPLAY_TYPE: REPLAY_TYPE,
  DO_REPLAY_TYPE: DO_REPLAY_TYPE,
  COMMON_TYPE: COMMON_TYPE,
  SEND_TYPE: SEND_TYPE,
  INFO_TYPE,
  GET_TYPE,
  ERROR_TYPE,
  NOTICE_TYPE,
  NEED_HANDLE_SELF_MSG_TYPE,
  SOCKET_ERROR_CODE,
  DELAY_TYPE
}

module.exports = TYPE
